#!/bin/sh

# Load the function
. $LKP_SRC/lib/git.sh

# Run tests from data file
while IFS= read -r input; do
  # Skip blank lines
  [ -z "$input" ] && continue

  # Read the expected output
  IFS= read -r expected

  # Run the function
  url2cache_dir "$input"

  # Compare the output
  if [ "$cache_dir" = "$expected" ]; then
    echo "PASS: $input -> $cache_dir"
  else
    echo "FAIL: $input"
    echo "output: $cache_dir"
    echo "expect: $expected"
  fi
done < $LKP_SRC/spec/url2cache_dir/data.txt
